package com.yiqi.news.mvp.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yiqi.huize.loadImage
import com.yiqi.news.R
import com.yiqi.news.app.utils.TimeUtils
import com.yiqi.news.entity.Comment
import kotlinx.android.synthetic.main.item_comment.view.*

class ReplayCommentAdapter : BaseQuickAdapter<Comment.RatingReplyVoListBean, BaseViewHolder>(R.layout.item_replay_comment) {
    override fun convert(helper: BaseViewHolder, item: Comment.RatingReplyVoListBean) {
        val itemView = helper.itemView
        itemView.tv_comment_content.text = item.content
        itemView.tv_comment_nick.text = item.fromUsername
        itemView.iv_comment_avatar.loadImage(item.fromHeadImg)
//        itemView.tv_comment_date.text = DateUtils.getShortTime(item.createTime * 1000L)
        itemView.tv_comment_date.text = TimeUtils.stampToDate4(item.createTime)
        itemView.tv_comment_like_count.text = item.commentZanCount.toString()
        itemView.iv_comment_like.setImageResource(if (!item?.haveZan.isNullOrEmpty() && item?.haveZan == "1") R.mipmap.ic_toolbar_news_like else R.mipmap.ic_toolbar_news_dislike)
        helper.addOnClickListener(R.id.iv_comment_comment)
                .addOnClickListener(R.id.btn_comment_like_count)



    }
}